package jp.oesf.test;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class MainActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Intent intent = getIntent();

       	String message1 = intent.getStringExtra("message1");
       	String message2 = intent.getStringExtra("message2");

       	if(message1 != null || message2 != null ){
           	TextView textView = (TextView)findViewById(R.id.textView1);
           	textView.setText(message1 + message2);
       	}
    }

    public void onClickNextButton(View view) {
		Intent intent = new Intent(this, NextActivity.class);
		startActivityForResult(intent, 0);
	}

    protected void onActivityResult(int requestCode, int resultCode, Intent intent) {

    	if(requestCode==0 && resultCode==RESULT_OK){
        	Bundle extras=intent.getExtras();

        	if (extras != null){
               	String message1 = intent.getStringExtra("message1");
               	String message2 = intent.getStringExtra("message2");
               	TextView textView = (TextView)findViewById(R.id.textView1);
               	textView.setText(message1 + message2);
        	}
    	}


    }

}